package com.zjht.gmcc.bean.model;

import java.io.Serializable;

/**
 * 平台缺货预警
 * @author YOUCL 2011-1-28
 *
 */
public class ProvWarningList implements Serializable {

	private static final long serialVersionUID = -4322364603002588421L;
	private String areaid;
	private String productid;
	private String provOrgid;//省平台orgid
	private String key;//(areaid+productid+provOrgid)
	private int totalAmount;//累计订单量
	private int saleBatch;//本批次销量
	private int totalBatch;//累计销量
	//private int available;//平台可用资源(totalAmount-totalBatch)
	private int depotCityHall;//市仓和服务厅库存
	private double cityRate;//市平台分货占比
	private int depotProv;//省仓库存
	//private int delayAllot;//待分仓(cityRate*depotProv)
	private int arrival;//已到货
	//private int unarrival;//未到货(totalAmount-totalBatch-delayAllot)
	private int saleDay;//前日销量
	//private int fillApply;//待补货（depotCityHall+delayAllot）
	//private boolean isStockOut;//已缺货(depotCityHall < saleDay)
	//private boolean isPlenty;//不充足(depotCityHall < 7*saleDay)
	//private boolean isAvailable;//平台可用资源不充足(available < 15*saleDay)
	//private boolean isFillApply;//待补货(delayAllot+depotCityHall < 15*saleDay)
	//private boolean flag;//(!isStockOut && !isStockOut && !isAvailable && !isFillApply)
	public String getKey() {
		return key;
	}
	public void setKey(String key) {
		this.key = key;
	}
	public int getSaleBatch() {
		return saleBatch;
	}
	public void setSaleBatch(int saleBatch) {
		this.saleBatch = saleBatch;
	}
	public int getAvailable() {
		return getTotalAmount() - getTotalBatch() > 0?getTotalAmount() - getTotalBatch():0;
	}
	public int getDepotCityHall() {
		return depotCityHall;
	}
	public void setDepotCityHall(int depotCityHall) {
		this.depotCityHall = depotCityHall;
	}
	public double getCityRate() {
		return cityRate;
	}
	public void setCityRate(double cityRate) {
		this.cityRate = cityRate;
	}
	public int getDepotProv() {
		return depotProv;
	}
	public void setDepotProv(int depotProv) {
		this.depotProv = depotProv;
	}
	public int getDelayAllot() {
		return (int)Math.round(getCityRate()*getDepotProv());
	}
	public int getArrival() {
		return arrival;
	}
	public int getUnarrival() {
		return getTotalAmount()-getTotalBatch()-getDelayAllot()>0?getTotalAmount()-getTotalBatch()-getDelayAllot():0;
	}
	
	public int getSaleDay() {
		return saleDay;
	}
	public void setSaleDay(int saleDay) {
		this.saleDay = saleDay;
	}
	/*public int getFillApply() {
		return getDepotCityHall()+getDelayAllot();
	}*/
	
	@Override
	public boolean equals(Object obj) {
		return key.equals(((ProvWarningList)obj).getKey());
	}
	public String getAreaid() {
		return areaid;
	}
	public void setAreaid(String areaid) {
		this.areaid = areaid;
	}
	public String getProductid() {
		return productid;
	}
	public void setProductid(String productid) {
		this.productid = productid;
	}
	public String getProvOrgid() {
		return provOrgid;
	}
	public void setProvOrgid(String provOrgid) {
		this.provOrgid = provOrgid;
	}
	public boolean isStockOut() {
		return getDepotCityHall() < getSaleDay();
	}
	/*public boolean isPlenty() {
		return getDepotCityHall() < 7*getSaleDay();
	}
	public boolean isAvailable() {
		return getAvailable() < 15 * getSaleDay();
	}
	public boolean isFillApply() {
		return getDelayAllot()+getDepotCityHall() < 15 * getSaleDay();
	}
	public boolean isFlag() {
		return !isStockOut() && !isPlenty() && !isAvailable() && !isFillApply();
	}*/
	public void setArrival(int arrival) {
		this.arrival = arrival;
	}
	public int getTotalAmount() {
		return totalAmount;
	}
	public void setTotalAmount(int totalAmount) {
		this.totalAmount = totalAmount;
	}
	public int getTotalBatch() {
		return totalBatch;
	}
	public void setTotalBatch(int totalBatch) {
		this.totalBatch = totalBatch;
	}
	
}
